import {
  Entity,
  Column,
  PrimaryGeneratedColumn,
  BeforeInsert,
  UpdateDateColumn,
} from 'typeorm';
import { v4 as uuidv4 } from 'uuid';
@Entity()
export class Video {
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Column()
  creator: string;

  @Column()
  file_id: string;

  @Column({
    type: 'timestamp without time zone',
    default: () => 'CURRENT_TIMESTAMP',
  })
  create_time: Date;

  @UpdateDateColumn({
    type: 'timestamp without time zone',
    default: () => 'CURRENT_TIMESTAMP',
  })
  update_time: Date;

  @Column()
  start: number;

  @Column()
  finish: number;

  @Column({ type: 'double precision', default: 20 })
  left: number;

  @Column({ type: 'double precision', default: 20 })
  top: number;

  @Column({ type: 'double precision', default: 400 })
  width: number;

  @Column({ type: 'double precision', default: 300 })
  height: number;

  @Column({ default: 2 })
  zIndex: number;

  @Column({ type: 'double precision', default: 1 })
  volume: number;

  @Column({ type: 'double precision', default: 0 })
  fadeInTime: number;

  @Column({ type: 'double precision', default: 0 })
  fadeOutTime: number;

  @Column({ type: 'double precision', default: 0 })
  currentTime: number;

  @Column()
  muted: boolean;

  @Column()
  loop: boolean;

  @Column({ type: 'double precision', default: 1 })
  speed: number;

  // 标识场景实例的使用的file_id 是公共资源的还是用户资源的
  @Column('enum', { enum: ['user', 'public'], default: 'user' })
  resource_type: string;
}
